|
|
|
|
|
|
|
All objects in Visual Basic do not have the same set of properties. However, several properties are common to many objects. Important common properties include the following: |
|
|
|
|
|
|
|
|
Using Properties to Control an Object's Size |
|
|
|
|
|
|
|
|
The size of an object in Visual Basic is governed by its Height and Width properties. As you've seen, you can modify an object's size by selecting it and dragging a sizing handle at design-time, or by changing the values of its Height and Width properties at either design time or runtime. If you resize an object at design time, you see a corresponding change in the Height and Width properties in the Properties window, as you discovered in Chapter 2. |
|
|
|
|
|
|
|
|
During program execution (in other words, at runtime), you can use code to initiate a change in an object's size. In some cases, the size of an object (such as a form) can be changed by the users, as when they drag the edge of the form. In the "Changing Properties at Runtime" section, you'll see an example that demonstrates this concept. |
|
|
|
|
|
|
|
|
Figure 3.5 illustrates how a form's Height and Width properties relate to its size. |
|
|
|
|
|
|
|
|
Figure 3.5
A form's size is determined by its Height and Width properties. |
|
|
|
|
|
|
|
|
Using Properties to Adjust an Object's Position |
|
|
|
|
|
|
|
|
In addition to controlling an object's size, you can also control its position with the Left and Top properties (see Figure 3.6). The Left property specifies the distance of the left side of an |
|
|
|
|
|